package com.liugui.springbootexceptionhandler.exception;

import com.liugui.springbootexceptionhandler.vo.ResultVO;
import lombok.Data;

/**
 * @ClassName: BusinessException
 * @Author: liugui
 * @Date: 2020-06-25 22:24
 **/
@Data
public class BusinessException extends BaseException{

    private ResultVO result = new ResultVO<>();

    public BusinessException(ResultVO result) {
        super(result.getCode() + ":" + result.getMsg());
        this.result = result;
    }

    public BusinessException(Integer code, String msg) {
        super(code + ":" + msg);
        this.result.setCode(code);
        this.result.setMsg(msg);
    }

    public BusinessException(ResultVO result, Throwable cause) {
        super(result.getCode() + ":" + result.getMsg(), cause);
        this.result = result;
    }

    public BusinessException(Integer code, String msg, Throwable cause) {
        super(code + ":" + msg, cause);
        this.result.setCode(code);
        this.result.setMsg(msg);
    }

}
